<?php
namespace app\member\controller;
use think\Controller;
use app\member\model\Member as MemberModel;
class Login extends Common
{
    public function index()
    {
    	
        if(request()->isPost()){
            $this->check(input('ckcode'));
        	$member=new MemberModel();
        	$num=$member->login(input('post.'));
        	if($num==1){
        		$this->error('用户不存在！');
        	}
        	if($num==2){
        		$this->success('登录成功！',url('index/index/index'));
        	}
        	if($num==3){
        		$this->error('密码错误！');
        	}
        	return;
        }
        return view();
    }



 // 验证码检测
    public function check($code='')
    {
        if (!captcha_check($code)) {
            $this->error('验证码错误');
        } else {
            return true;
        }
    }


     public function logout(){
        session(null); 
        $this->success('退出系统成功！',url('member/login/index'));
    }
  
}
